package Value类型

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object groupBy {

    def main(args: Array[String]): Unit = {

        val config: SparkConf = new SparkConf().setMaster("local[*]").setAppName("WordCount")

        val sc = new SparkContext(config)

        val rdd = sc.parallelize(1 to 16, 4)

        val groupByRDD: RDD[(Int, Iterable[Int])] = rdd.groupBy(i => i % 4)

        groupByRDD.collect().foreach(println)


    }

}
